import time

if __name__ == "__main__":
    ticks = time.time()
    print("当前时间戳为：", ticks)

    # 格式化成2020-03-20 11:45:39形式
    print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ticks)))
    # 格式化成Sat Mar 28 22:24:24 2020形式
    dateTime = time.strftime("%a %b %d %H:%M:%S %Y", time.localtime(ticks))
    print(dateTime)
    # 将格式字符串转换为时间戳
    print(time.mktime(time.strptime(dateTime, "%a %b %d %H:%M:%S %Y")))

